package com.zhihesj.anan.system.controller;


import cn.hutool.core.bean.BeanUtil;
import com.zhihesj.anan.message.Message;
import com.zhihesj.anan.system.entity.Notice;
import com.zhihesj.anan.system.service.NoticeService;
import com.zhihesj.anan.system.vo.NoticeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 通知公告表 前端控制器
 * </p>
 *
 * @author anan
 * @since 2020-07-31
 */
@RestController
@RequestMapping("/system/notice")
public class NoticeController {

    @Autowired
    private NoticeService noticeService;

    @GetMapping("/getNoticeList")
    public Message getDictTypeList(NoticeVo noticeVo){
        System.out.println(noticeVo);
        Map<String, Object> stringObjectMap = BeanUtil.beanToMap(noticeVo, false, true);
        List<Notice> notices=null;
        if (stringObjectMap.isEmpty()) {
            notices = noticeService.list();
        } else {
            notices = noticeService.list();
        }
        return Message.success(notices);
    }
}
